package com.mysoft.gfyx.marketdevelop.service;



import com.mysoft.framework.modeling.dto.FieldsSetting;
import com.mysoft.framework.modeling.dto.ListDataResult;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.gfyx.marketdevelop.controller.dto.advancesearch.AdvanceSearchCustomerRequestDto;
import com.mysoft.gfyx.marketdevelop.controller.dto.advancesearch.AdvanceSearchFieldGroupDto;
import com.mysoft.gfyx.marketdevelop.controller.dto.advancesearch.GetSavedAdvanceSearchTemplateRequestDto;
import com.mysoft.gfyx.marketdevelop.controller.dto.advancesearch.SaveAdvanceSearchTemplateRequestDto;
import com.mysoft.gfyx.marketdevelop.dao.entity.AdvanceSearchUserSaved;
import com.mysoft.gfyx.marketdevelop.mip.dto.BaseTjListDto;
import com.mysoft.gfyx.marketdevelop.service.dto.AdvanceSearchUserSavedDetailDto;
import com.mysoft.gfyx.marketdevelop.service.dto.AdvanceSearchUserSavedDto;

import java.text.ParseException;
import java.util.*;

/**
* 高级筛选
*/
public interface AdvanceSearchService {
    int RELATIVE_NONE = 0;
    int RELATIVE_AND = 1;
    public static final int RELATIVE_OR = 2;
    String ACTIONCODE_EQ = "eq"; //等于  逻辑：field = value[0] 不需要子查询
    String ACTIONCODE_NEQ = "neq"; //不等于  逻辑：field != value[0] 不需要子查询
    String ACTIONCODE_IN = "in"; //等于任一  逻辑：field in (value[0],value[1]...) 不需要子查询
    String ACTIONCODE_NOT_IN_ALL = "notInAll"; //不等于所有  逻辑：field not in (value[0],value[1]...) 不需要子查询
    String ACTIONCODE_EXIST = "exist"; //有 逻辑：field not null 不需要子查询
    String ACTIONCODE_NOT_EXIST = "notExist"; //没有 逻辑：field is null 不需要子查询

    String ACTIONCODE_TEXT_IN = "textIn"; //文本包含任一  逻辑：field like %value[0]% or field like %value[1]%... 需要子查询
    String ACTIONCODE_TEXT_NOT_IN_ALL = "textNotInAll"; //文本不包含所有 逻辑：field not like %value[0]% and field not like %value[1]%... 需要子查询

    String ACTIONCODE_SELECT = "select"; //自定义下拉 ，options<text, value> 定义下拉内容  —— 下拉单选类
    String ACTIONCODE_NUMBER_RANGE = "numberRange"; //金额范围类、数值范围类 逻辑：field >= value[0] and field <= value[1] 需要子查询
    String ACTIONCODE_DATE_RANGE = "dateRange"; //日期范围类 逻辑：field >= value[0] and field <= value[1] 需要子查询

    //属于标签的字段，和数芯标签做映射
    HashMap<String, String > tagFields = new HashMap<String, String>(){{
        //左边是建模的key，右边是数芯的key
        //企业类型
        put(DeveloperService.DEVELOPER_MAIN + "_"+"enterprise_nature", "company_type_label");
        //营业状态
        put(DeveloperService.DEVELOPER_MAIN + "_"+"status", "business_status_label");
        //项目装修，交房标准
        put(DeveloperService.TABLE_OPENED_TRADING + "_"+"decorate", "fitment_fee_label");
        //土地用途
        // put(DeveloperService.TABLE_TAKE_LAND + "_"+"land_usage", "land_usage_label");
        //项目类型
        put(DeveloperService.TABLE_OPENED_TRADING + "_"+"property_category", "property_category_label");
        //废弃上市企业，特殊标签，是企业类型的标签，又要放在外层。。。。。特殊处理
        put(DeveloperService.DEVELOPER_MAIN + "_"+"listed_enterprises_label", "listed_company_label");
    }};
//    HashSet<String> tagFields = new HashSet<String>(){{
//        String company_type_label = DeveloperService.DEVELOPER_MAIN + "_company_type_label";
//        String status = DeveloperService.DEVELOPER_MAIN + "_status";
//    }};

//    UUID saveOpptySubs(OpptySubsDto saveOpptySubsDto);
//    List<SubsNameDto> getSubsNameList(Integer subsType);
//    int getSubsCount();
//    boolean enable(UUID opptySubsGUID, int enable);
//    boolean delete(UUID opptySubsGUID) throws BusinessLogicException;
//    OpptySubsDto getOne(UUID opptySubsGUID) throws BusinessLogicException;
//    List<OpptySubsDto> getAllEnabledOpptySubs() throws BusinessLogicException;
//    List<OpptySubsDto> getAllInOneMinuteEnabledOpptySubs() throws BusinessLogicException;
//
//    //保存商机订阅潜在客户数据
//    UUID saveOpptySubsCustomerData(OpptySubsCustomerDataDto saveOpptySubsDto);
//    UUID saveOpptySubsPurchaseData(OpptySubsPurchaseDataDto opptySubsPurchaseDataDto);

    //获取高级筛选字段组列表（元数据）
    AdvanceSearchFieldGroupDto getAdvanceSearchFieldGroup();
    Object searchCustomer(AdvanceSearchCustomerRequestDto advanceSearchCustomerRequestDto) throws ParseException;

    //找商机
    BaseTjListDto searchOpptyPurchase(AdvanceSearchCustomerRequestDto advanceSearchCustomerRequestDto);

    UUID saveAdvanceSearchTemplate(SaveAdvanceSearchTemplateRequestDto saveAdvanceSearchTemplateRequestDto);

    boolean addAdvanceSearchTemplateUseCount(AdvanceSearchUserSavedDto advanceSearchUserSavedDto);

    List<AdvanceSearchUserSavedDto> getSavedAdvanceSearchTemplate();
    List<AdvanceSearchUserSavedDetailDto> getSavedAdvanceSearchTemplateDetail(UUID advanceSearchUserSavedGUID);
    AdvanceSearchUserSavedDto getSavedAdvanceSearchTemplateById(UUID advanceSearchUserSavedGUID);
    boolean delSavedAdvanceSearchTemplate(UUID advanceSearchUserSavedGUID);

    FieldsSetting loadSearchCustomerFields();
    ListDataResult loadSearchCustomerData(LoadDataParams options);


    FieldsSetting loadSearchOpptyPurchaseFields();
    ListDataResult loadSearchOpptyPurchaseData(LoadDataParams options);

}

